/*
 * Created on 2007-8-31
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.tongji.quickCRUDQ.tag;

import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.tongji.quickCRUDQ.define.Row;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class RowTag extends TagSupport {

	private String rowName;

	/* (non-Javadoc)
	 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
	 */
	public int doEndTag() throws JspException {
		TableTag tableTag=(TableTag) this.getParent();
		Map model=(Map) this.pageContext.getRequest().getAttribute("model");
		Row row=(Row) model.get(this.getRowName());
		tableTag.getColumns().addAll(row.getColumnList());
		return EVAL_PAGE;
	}

	/* (non-Javadoc)
	 * @see javax.servlet.jsp.tagext.Tag#release()
	 */
	public void release() {
		this.rowName=null;
		super.release();
	}
	/**
	 * @return Returns the rowName.
	 */
	public String getRowName() {
		return rowName;
	}
	/**
	 * @param rowName The rowName to set.
	 */
	public void setRowName(String property1) {
		this.rowName = property1;
	}
}
